﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using System.Data.Objects.DataClasses;

namespace FinalProject.DAL.Model
{
    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    [EdmEntityTypeAttribute(NamespaceName = "InvoiceModel", Name = "DocumentRow")]
    [Serializable()]
    [DataContractAttribute(IsReference = true)]
    public partial class DocumentRow : EntityObject
    {
        #region Factory Method

        /// <summary>
        /// Create a new DocumentRow object.
        /// </summary>
        /// <param name="id">Initial value of the Id property.</param>
        /// <param name="rowNumber">Initial value of the RowNumber property.</param>
        /// <param name="unitPrice">Initial value of the UnitPrice property.</param>
        /// <param name="quantity">Initial value of the Quantity property.</param>
        /// <param name="totalAmount">Initial value of the TotalAmount property.</param>
        /// <param name="description">Initial value of the Description property.</param>
        /// <param name="deliveryDocumentId">Initial value of the DeliveryDocumentId property.</param>
        /// <param name="invoiceDocumentId">Initial value of the InvoiceDocumentId property.</param>
        /// <param name="orderDocumentId">Initial value of the OrderDocumentId property.</param>
        /// <param name="itemId">Initial value of the ItemId property.</param>
        public static DocumentRow CreateDocumentRow(global::System.Guid id,
            global::System.Int32 rowNumber,
            global::System.Decimal unitPrice,
            global::System.Int32 quantity,
            global::System.Decimal totalAmount,
            global::System.String description,
            global::System.Guid deliveryDocumentId,
            global::System.Guid invoiceDocumentId,
            global::System.Guid orderDocumentId,
            global::System.Guid itemId)
        {
            DocumentRow documentRow = new DocumentRow();
            documentRow.Id = id;
            documentRow.RowNumber = rowNumber;
            documentRow.UnitPrice = unitPrice;
            documentRow.Quantity = quantity;
            documentRow.TotalAmount = totalAmount;
            documentRow.Description = description;
            documentRow.DeliveryDocumentId = deliveryDocumentId;
            documentRow.InvoiceDocumentId = invoiceDocumentId;
            documentRow.OrderDocumentId = orderDocumentId;
            documentRow.ItemId = itemId;
            return documentRow;
        }

        #endregion
        #region Primitive Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = true, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Guid Id
        {
            get
            {
                return _Id;
            }
            set
            {
                if (_Id != value)
                {
                    OnIdChanging(value);
                    ReportPropertyChanging("Id");
                    _Id = StructuralObject.SetValidValue(value);
                    ReportPropertyChanged("Id");
                    OnIdChanged();
                }
            }
        }
        private global::System.Guid _Id;
        partial void OnIdChanging(global::System.Guid value);
        partial void OnIdChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Int32? RowNumber
        {
            get
            {
                return _RowNumber;
            }
            set
            {
                OnRowNumberChanging(value);
                ReportPropertyChanging("RowNumber");
                _RowNumber = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("RowNumber");
                OnRowNumberChanged();
            }
        }
        private global::System.Int32? _RowNumber;
        partial void OnRowNumberChanging(global::System.Int32? value);
        partial void OnRowNumberChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Decimal? UnitPrice
        {
            get
            {
                return _UnitPrice;
            }
            set
            {
                OnUnitPriceChanging(value);
                ReportPropertyChanging("UnitPrice");
                _UnitPrice = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("UnitPrice");
                OnUnitPriceChanged();
            }
        }
        private global::System.Decimal? _UnitPrice;
        partial void OnUnitPriceChanging(global::System.Decimal? value);
        partial void OnUnitPriceChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Int32? Quantity
        {
            get
            {
                return _Quantity;
            }
            set
            {
                OnQuantityChanging(value);
                ReportPropertyChanging("Quantity");
                _Quantity = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("Quantity");
                OnQuantityChanged();
            }
        }
        private global::System.Int32? _Quantity;
        partial void OnQuantityChanging(global::System.Int32? value);
        partial void OnQuantityChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
        [DataMemberAttribute()]
        public global::System.Decimal? TotalAmount
        {
            get
            {
                return _TotalAmount;
            }
            set
            {
                OnTotalAmountChanging(value);
                ReportPropertyChanging("TotalAmount");
                _TotalAmount = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("TotalAmount");
                OnTotalAmountChanged();
            }
        }
        private global::System.Decimal? _TotalAmount;
        partial void OnTotalAmountChanging(global::System.Decimal? value);
        partial void OnTotalAmountChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
        [DataMemberAttribute()]
        public global::System.String Description
        {
            get
            {
                return _Description;
            }
            set
            {
                OnDescriptionChanging(value);
                ReportPropertyChanging("Description");
                _Description = StructuralObject.SetValidValue(value, true);
                ReportPropertyChanged("Description");
                OnDescriptionChanged();
            }
        }
        private global::System.String _Description;
        partial void OnDescriptionChanging(global::System.String value);
        partial void OnDescriptionChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
        [DataMemberAttribute()]
        public global::System.Guid? DeliveryDocumentId
        {
            get
            {
                return _DeliveryDocumentId;
            }
            set
            {
                OnDeliveryDocumentIdChanging(value);
                ReportPropertyChanging("DeliveryDocumentId");
                _DeliveryDocumentId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("DeliveryDocumentId");
                OnDeliveryDocumentIdChanged();
            }
        }
        private global::System.Guid? _DeliveryDocumentId;
        partial void OnDeliveryDocumentIdChanging(global::System.Guid? value);
        partial void OnDeliveryDocumentIdChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
        [DataMemberAttribute()]
        public global::System.Guid? InvoiceDocumentId
        {
            get
            {
                return _InvoiceDocumentId;
            }
            set
            {
                OnInvoiceDocumentIdChanging(value);
                ReportPropertyChanging("InvoiceDocumentId");
                _InvoiceDocumentId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("InvoiceDocumentId");
                OnInvoiceDocumentIdChanged();
            }
        }
        private global::System.Guid? _InvoiceDocumentId;
        partial void OnInvoiceDocumentIdChanging(global::System.Guid? value);
        partial void OnInvoiceDocumentIdChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
        [DataMemberAttribute()]
        public global::System.Guid? OrderDocumentId
        {
            get
            {
                return _OrderDocumentId;
            }
            set
            {
                OnOrderDocumentIdChanging(value);
                ReportPropertyChanging("OrderDocumentId");
                _OrderDocumentId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("OrderDocumentId");
                OnOrderDocumentIdChanged();
            }
        }
        private global::System.Guid? _OrderDocumentId;
        partial void OnOrderDocumentIdChanging(global::System.Guid? value);
        partial void OnOrderDocumentIdChanged();

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
        [DataMemberAttribute()]
        public global::System.Guid ItemId
        {
            get
            {
                return _ItemId;
            }
            set
            {
                OnItemIdChanging(value);
                ReportPropertyChanging("ItemId");
                _ItemId = StructuralObject.SetValidValue(value);
                ReportPropertyChanged("ItemId");
                OnItemIdChanged();
            }
        }
        private global::System.Guid _ItemId;
        partial void OnItemIdChanging(global::System.Guid value);
        partial void OnItemIdChanged();

        #endregion

        #region Navigation Properties

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "DeliveryDocumentDocumentRow", "DeliveryDocument")]
        public DeliveryDocument DeliveryDocument
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<DeliveryDocument>("InvoiceModel.DeliveryDocumentDocumentRow", "DeliveryDocument").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<DeliveryDocument>("InvoiceModel.DeliveryDocumentDocumentRow", "DeliveryDocument").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<DeliveryDocument> DeliveryDocumentReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<DeliveryDocument>("InvoiceModel.DeliveryDocumentDocumentRow", "DeliveryDocument");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<DeliveryDocument>("InvoiceModel.DeliveryDocumentDocumentRow", "DeliveryDocument", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "InvoiceDocumentDocumentRow", "InvoiceDocument")]
        public InvoiceDocument InvoiceDocument
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InvoiceDocument>("InvoiceModel.InvoiceDocumentDocumentRow", "InvoiceDocument").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InvoiceDocument>("InvoiceModel.InvoiceDocumentDocumentRow", "InvoiceDocument").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<InvoiceDocument> InvoiceDocumentReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<InvoiceDocument>("InvoiceModel.InvoiceDocumentDocumentRow", "InvoiceDocument");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<InvoiceDocument>("InvoiceModel.InvoiceDocumentDocumentRow", "InvoiceDocument", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "OrderDocumentDocumentRow", "OrderDocument")]
        public OrderDocument OrderDocument
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<OrderDocument>("InvoiceModel.OrderDocumentDocumentRow", "OrderDocument").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<OrderDocument>("InvoiceModel.OrderDocumentDocumentRow", "OrderDocument").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<OrderDocument> OrderDocumentReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<OrderDocument>("InvoiceModel.OrderDocumentDocumentRow", "OrderDocument");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<OrderDocument>("InvoiceModel.OrderDocumentDocumentRow", "OrderDocument", value);
                }
            }
        }

        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [XmlIgnoreAttribute()]
        [SoapIgnoreAttribute()]
        [DataMemberAttribute()]
        [EdmRelationshipNavigationPropertyAttribute("InvoiceModel", "ItemDocumentRow", "Item")]
        public Item Item
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Item>("InvoiceModel.ItemDocumentRow", "Item").Value;
            }
            set
            {
                ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Item>("InvoiceModel.ItemDocumentRow", "Item").Value = value;
            }
        }
        /// <summary>
        /// No Metadata Documentation available.
        /// </summary>
        [BrowsableAttribute(false)]
        [DataMemberAttribute()]
        public EntityReference<Item> ItemReference
        {
            get
            {
                return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Item>("InvoiceModel.ItemDocumentRow", "Item");
            }
            set
            {
                if ((value != null))
                {
                    ((IEntityWithRelationships)this).RelationshipManager.InitializeRelatedReference<Item>("InvoiceModel.ItemDocumentRow", "Item", value);
                }
            }
        }

        #endregion
    }

}
